
import os
import tools
import glob
from mysqlDB_test import Mymysql,MyOracle

conn = tools.parse_ini('oracle').get('crqs_test')
role_user_path = tools.parse_ini('path').get('roles_users')
oracle_conn = MyOracle(conn)
def run_sql_file(db_conn): #批量跑sql文件
    for file in glob.glob(os.path.join(role_user_path, '*.txt')):
            tools.logger.info('正在执行文件%s的sql'%file)
            with open(file, encoding='utf-8') as fr:
                for line in fr:
                    line.strip()
                    line = line.replace(';','')
                    db_conn.execute_other(line)
                    tools.logger.info('sql执行成功，执行的sql是：%s'%line)

if __name__ == '__main__':
    pass
    # run_sql_file(oracle_conn)


